home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Programming / gcc-2.95.3-3 / info / g77.info-20 < prev    next >
Encoding:
GNU Info File  |  2001-07-15  |  14.5 KB  |  358 lines

  1. This is Info file f/g77.info, produced by Makeinfo version 1.68 from
  2. the input file ./f/g77.texi.
  3.  
  4. INFO-DIR-SECTION Programming
  5. START-INFO-DIR-ENTRY
  6. * g77: (g77).                  The GNU Fortran compiler.
  7. END-INFO-DIR-ENTRY
  8.    This file documents the use and the internals of the GNU Fortran
  9. (`g77') compiler.  It corresponds to the GCC-2.95 version of `g77'.
  10.  
  11.    Published by the Free Software Foundation 59 Temple Place - Suite 330
  12. Boston, MA 02111-1307 USA
  13.  
  14.    Copyright (C) 1995-1999 Free Software Foundation, Inc.
  15.  
  16.    Permission is granted to make and distribute verbatim copies of this
  17. manual provided the copyright notice and this permission notice are
  18. preserved on all copies.
  19.  
  20.    Permission is granted to copy and distribute modified versions of
  21. this manual under the conditions for verbatim copying, provided also
  22. that the sections entitled "GNU General Public License," "Funding for
  23. Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are
  24. included exactly as in the original, and provided that the entire
  25. resulting derived work is distributed under the terms of a permission
  26. notice identical to this one.
  27.  
  28.    Permission is granted to copy and distribute translations of this
  29. manual into another language, under the above conditions for modified
  30. versions, except that the sections entitled "GNU General Public
  31. License," "Funding for Free Software," and "Protect Your Freedom--Fight
  32. `Look And Feel'", and this permission notice, may be included in
  33. translations approved by the Free Software Foundation instead of in the
  34. original English.
  35.  
  36.    Contributed by James Craig Burley (<craig@jcb-sc.com>).  Inspired by
  37. a first pass at translating `g77-0.5.16/f/DOC' that was contributed to
  38. Craig by David Ronis (<ronis@onsager.chem.mcgill.ca>).
  39.  
  40. 
  41. File: g77.info,  Node: EXPIMP,  Next: INTGLOB,  Prev: CMPAMBIG,  Up: Diagnostics
  42.  
  43. `EXPIMP'
  44. ========
  45.  
  46.      Intrinsic INTRINSIC referenced ...
  47.  
  48.    The INTRINSIC is explicitly declared in one program unit in the
  49. source file and implicitly used as an intrinsic in another program unit
  50. in the same source file.
  51.  
  52.    This diagnostic is designed to catch cases where a program might
  53. depend on using the name INTRINSIC as an intrinsic in one program unit
  54. and as a global name (such as the name of a subroutine or function) in
  55. another, but `g77' recognizes the name as an intrinsic in both cases.
  56.  
  57.    After verifying that the program unit making implicit use of the
  58. intrinsic is indeed written expecting the intrinsic, add an `INTRINSIC
  59. INTRINSIC' statement to that program unit to prevent this warning.
  60.  
  61.    This and related warnings are disabled by using the `-Wno-globals'
  62. option when compiling.
  63.  
  64.    Note that this warning is not issued for standard intrinsics.
  65. Standard intrinsics include those described in the FORTRAN 77 standard
  66. and, if `-ff90' is specified, those described in the Fortran 90
  67. standard.  Such intrinsics are not as likely to be confused with user
  68. procedures as intrinsics provided as extensions to the standard by
  69. `g77'.
  70.  
  71. 
  72. File: g77.info,  Node: INTGLOB,  Next: LEX,  Prev: EXPIMP,  Up: Diagnostics
  73.  
  74. `INTGLOB'
  75. =========
  76.  
  77.      Same name `INTRINSIC' given ...
  78.  
  79.    The name INTRINSIC is used for a global entity (a common block or a
  80. program unit) in one program unit and implicitly used as an intrinsic
  81. in another program unit.
  82.  
  83.    This diagnostic is designed to catch cases where a program intends
  84. to use a name entirely as a global name, but `g77' recognizes the name
  85. as an intrinsic in the program unit that references the name, a
  86. situation that would likely produce incorrect code.
  87.  
  88.    For example:
  89.  
  90.      INTEGER FUNCTION TIME()
  91.      ...
  92.      END
  93.      ...
  94.      PROGRAM SAMP
  95.      INTEGER TIME
  96.      PRINT *, 'Time is ', TIME()
  97.      END
  98.  
  99.    The above example defines a program unit named `TIME', but the
  100. reference to `TIME' in the main program unit `SAMP' is normally treated
  101. by `g77' as a reference to the intrinsic `TIME()' (unless a
  102. command-line option that prevents such treatment has been specified).
  103.  
  104.    As a result, the program `SAMP' will *not* invoke the `TIME'
  105. function in the same source file.
  106.  
  107.    Since `g77' recognizes `libU77' procedures as intrinsics, and since
  108. some existing code uses the same names for its own procedures as used
  109. by some `libU77' procedures, this situation is expected to arise often
  110. enough to make this sort of warning worth issuing.
  111.  
  112.    After verifying that the program unit making implicit use of the
  113. intrinsic is indeed written expecting the intrinsic, add an `INTRINSIC
  114. INTRINSIC' statement to that program unit to prevent this warning.
  115.  
  116.    Or, if you believe the program unit is designed to invoke the
  117. program-defined procedure instead of the intrinsic (as recognized by
  118. `g77'), add an `EXTERNAL INTRINSIC' statement to the program unit that
  119. references the name to prevent this warning.
  120.  
  121.    This and related warnings are disabled by using the `-Wno-globals'
  122. option when compiling.
  123.  
  124.    Note that this warning is not issued for standard intrinsics.
  125. Standard intrinsics include those described in the FORTRAN 77 standard
  126. and, if `-ff90' is specified, those described in the Fortran 90
  127. standard.  Such intrinsics are not as likely to be confused with user
  128. procedures as intrinsics provided as extensions to the standard by
  129. `g77'.
  130.  
  131. 
  132. File: g77.info,  Node: LEX,  Next: GLOBALS,  Prev: INTGLOB,  Up: Diagnostics
  133.  
  134. `LEX'
  135. =====
  136.  
  137.      Unrecognized character ...
  138.      Invalid first character ...
  139.      Line too long ...
  140.      Non-numeric character ...
  141.      Continuation indicator ...
  142.      Label at ... invalid with continuation line indicator ...
  143.      Character constant ...
  144.      Continuation line ...
  145.      Statement at ... begins with invalid token
  146.  
  147.    Although the diagnostics identify specific problems, they can be
  148. produced when general problems such as the following occur:
  149.  
  150.    * The source file contains something other than Fortran code.
  151.  
  152.      If the code in the file does not look like many of the examples
  153.      elsewhere in this document, it might not be Fortran code.  (Note
  154.      that Fortran code often is written in lower case letters, while
  155.      the examples in this document use upper case letters, for
  156.      stylistic reasons.)
  157.  
  158.      For example, if the file contains lots of strange-looking
  159.      characters, it might be APL source code; if it contains lots of
  160.      parentheses, it might be Lisp source code; if it contains lots of
  161.      bugs, it might be C++ source code.
  162.  
  163.    * The source file contains free-form Fortran code, but `-ffree-form'
  164.      was not specified on the command line to compile it.
  165.  
  166.      Free form is a newer form for Fortran code.  The older, classic
  167.      form is called fixed form.
  168.  
  169.      Fixed-form code is visually fairly distinctive, because numerical
  170.      labels and comments are all that appear in the first five columns
  171.      of a line, the sixth column is reserved to denote continuation
  172.      lines, and actual statements start at or beyond column 7.  Spaces
  173.      generally are not significant, so if you see statements such as
  174.      `REALX,Y' and `DO10I=1,100', you are looking at fixed-form code.
  175.      Comment lines are indicated by the letter `C' or the symbol `*' in
  176.      column 1.  (Some code uses `!' or `/*' to begin in-line comments,
  177.      which many compilers support.)
  178.  
  179.      Free-form code is distinguished from fixed-form source primarily
  180.      by the fact that statements may start anywhere.  (If lots of
  181.      statements start in columns 1 through 6, that's a strong indicator
  182.      of free-form source.)  Consecutive keywords must be separated by
  183.      spaces, so `REALX,Y' is not valid, while `REAL X,Y' is.  There are
  184.      no comment lines per se, but `!' starts a comment anywhere in a
  185.      line (other than within a character or Hollerith constant).
  186.  
  187.      *Note Source Form::, for more information.
  188.  
  189.    * The source file is in fixed form and has been edited without
  190.      sensitivity to the column requirements.
  191.  
  192.      Statements in fixed-form code must be entirely contained within
  193.      columns 7 through 72 on a given line.  Starting them "early" is
  194.      more likely to result in diagnostics than finishing them "late",
  195.      though both kinds of errors are often caught at compile time.
  196.  
  197.      For example, if the following code fragment is edited by following
  198.      the commented instructions literally, the result, shown afterward,
  199.      would produce a diagnostic when compiled:
  200.  
  201.           C On XYZZY systems, remove "C" on next line:
  202.           C     CALL XYZZY_RESET
  203.  
  204.      The result of editing the above line might be:
  205.  
  206.           C On XYZZY systems, remove "C" on next line:
  207.                CALL XYZZY_RESET
  208.  
  209.      However, that leaves the first `C' in the `CALL' statement in
  210.      column 6, making it a comment line, which is not really what the
  211.      author intended, and which is likely to result in one of the
  212.      above-listed diagnostics.
  213.  
  214.      *Replacing* the `C' in column 1 with a space is the proper change
  215.      to make, to ensure the `CALL' keyword starts in or after column 7.
  216.  
  217.      Another common mistake like this is to forget that fixed-form
  218.      source lines are significant through only column 72, and that,
  219.      normally, any text beyond column 72 is ignored or is diagnosed at
  220.      compile time.
  221.  
  222.      *Note Source Form::, for more information.
  223.  
  224.    * The source file requires preprocessing, and the preprocessing is
  225.      not being specified at compile time.
  226.  
  227.      A source file containing lines beginning with `#define',
  228.      `#include', `#if', and so on is likely one that requires
  229.      preprocessing.
  230.  
  231.      If the file's suffix is `.f', `.for', or `.FOR', the file normally
  232.      will be compiled *without* preprocessing by `g77'.
  233.  
  234.      Change the file's suffix from `.f' to `.F' (or, on systems with
  235.      case-insensitive file names, to `.fpp' or `.FPP'), from `.for' to
  236.      `.fpp', or from `.FOR' to `.FPP'.  `g77' compiles files with such
  237.      names *with* preprocessing.
  238.  
  239.      Or, learn how to use `gcc''s `-x' option to specify the language
  240.      `f77-cpp-input' for Fortran files that require preprocessing.
  241.      *Note gcc: (Using and Porting GNU CC)Overall Options.
  242.  
  243.    * The source file is preprocessed, and the results of preprocessing
  244.      result in syntactic errors that are not necessarily obvious to
  245.      someone examining the source file itself.
  246.  
  247.      Examples of errors resulting from preprocessor macro expansion
  248.      include exceeding the line-length limit, improperly starting,
  249.      terminating, or incorporating the apostrophe or double-quote in a
  250.      character constant, improperly forming a Hollerith constant, and
  251.      so on.
  252.  
  253.      *Note Options Controlling the Kind of Output: Overall Options, for
  254.      suggestions about how to use, and not use, preprocessing for
  255.      Fortran code.
  256.  
  257. 
  258. File: g77.info,  Node: GLOBALS,  Next: LINKFAIL,  Prev: LEX,  Up: Diagnostics
  259.  
  260. `GLOBALS'
  261. =========
  262.  
  263.      Global name NAME defined at ... already defined...
  264.      Global name NAME at ... has different type...
  265.      Too many arguments passed to NAME at ...
  266.      Too few arguments passed to NAME at ...
  267.      Argument #N of NAME is ...
  268.  
  269.    These messages all identify disagreements about the global procedure
  270. named NAME among different program units (usually including NAME
  271. itself).
  272.  
  273.    Whether a particular disagreement is reported as a warning or an
  274. error can depend on the relative order of the disagreeing portions of
  275. the source file.
  276.  
  277.    Disagreements between a procedure invocation and the *subsequent*
  278. procedure itself are, usually, diagnosed as errors when the procedure
  279. itself *precedes* the invocation.  Other disagreements are diagnosed
  280. via warnings.
  281.  
  282.    This distinction, between warnings and errors, is due primarily to
  283. the present tendency of the `gcc' back end to inline only those
  284. procedure invocations that are *preceded* by the corresponding
  285. procedure definitions.  If the `gcc' back end is changed to inline
  286. "forward references", in which invocations precede definitions, the
  287. `g77' front end will be changed to treat both orderings as errors,
  288. accordingly.
  289.  
  290.    The sorts of disagreements that are diagnosed by `g77' include
  291. whether a procedure is a subroutine or function; if it is a function,
  292. the type of the return value of the procedure; the number of arguments
  293. the procedure accepts; and the type of each argument.
  294.  
  295.    Disagreements regarding global names among program units in a
  296. Fortran program *should* be fixed in the code itself.  However, if that
  297. is not immediately practical, and the code has been working for some
  298. time, it is possible it will work when compiled with the `-fno-globals'
  299. option.
  300.  
  301.    The `-fno-globals' option causes these diagnostics to all be warnings
  302. and disables all inlining of references to global procedures (to avoid
  303. subsequent compiler crashes and bad-code generation).  Use of the
  304. `-Wno-globals' option as well as `-fno-globals' suppresses all of these
  305. diagnostics.  (`-Wno-globals' by itself disables only the warnings, not
  306. the errors.)
  307.  
  308.    After using `-fno-globals' to work around these problems, it is wise
  309. to stop using that option and address them by fixing the Fortran code,
  310. because such problems, while they might not actually result in bugs on
  311. some systems, indicate that the code is not as portable as it could be.
  312. In particular, the code might appear to work on a particular system,
  313. but have bugs that affect the reliability of the data without
  314. exhibiting any other outward manifestations of the bugs.
  315.  
  316. 
  317. File: g77.info,  Node: LINKFAIL,  Next: Y2KBAD,  Prev: GLOBALS,  Up: Diagnostics
  318.  
  319. `LINKFAIL'
  320. ==========
  321.  
  322.      If the above command failed due to an unresolved reference
  323.      to strtoul, _strtoul, bsearch, _bsearch, or similar, see
  324.      [info -f g77 M LINKFAIL] (a node in the g77 documentation)
  325.      for information on what causes this, how to work around
  326.      the problem by editing ${srcdir}/proj.c, and what else to do.
  327.  
  328.    *Note Missing strtoul or bsearch::, for more information on this
  329. problem, which occurs only in releases of `g77' based on `gcc'.  (It
  330. does not occur in `egcs'.)
  331.  
  332.    On AIX 4.1, `g77' might not build with the native (non-GNU) tools
  333. due to a linker bug in coping with the `-bbigtoc' option which leads to
  334. a `Relocation overflow' error.  The GNU linker is not recommended on
  335. current AIX versions, though; it was developed under a now-unsupported
  336. version.  This bug is said to be fixed by `update PTF U455193 for APAR
  337. IX75823'.
  338.  
  339.    Compiling with `-mminimal-toc' might solve this problem, e.g. by
  340. adding
  341.      BOOT_CFLAGS='-mminimal-toc -O2 -g'
  342.    to the `make bootstrap' command line.
  343.  
  344. 
  345. File: g77.info,  Node: Y2KBAD,  Prev: LINKFAIL,  Up: Diagnostics
  346.  
  347. `Y2KBAD'
  348. ========
  349.  
  350.      Intrinsic `NAME', invoked at (^), known to be non-Y2K-compliant...
  351.  
  352.    This diagnostic indicates that the specific intrinsic invoked by the
  353. name NAME is known to have an interface that is not Year-2000 (Y2K)
  354. compliant.
  355.  
  356.    *Note Year 2000 (Y2K) Problems::.
  357.  
  358.